package com.htudata.home.controller;

import com.htudata.common.enums.RequestSeqEnum;
import com.htudata.common.enums.RequestStatusEnum;
import com.htudata.convention.domain.ResponseResult;
import com.htudata.core.util.ResultGenerator;
import com.htudata.home.service.IFctService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class FctController {

  @Autowired
  private IFctService fctService;
  
  @GetMapping({"/v1/fct/getFctData"})
  public ResponseResult getFctData(String time) {
    try {
      return ResultGenerator.genResult(RequestSeqEnum.SEQ_011.getCode(), this.fctService.selectFctData(time));
    } catch (Exception e) {
      log.error("getFctData",e);
      return ResultGenerator.genErrorResult(RequestSeqEnum.SEQ_011.getCode(), RequestStatusEnum.STATUS_503
          .getCode(), "暂无数据");
    } 
  }
  
  @GetMapping({"/v1/fct/getMeteoPublicSatisfct"})
  public ResponseResult getMeteoPublicSatisfct() {
    try {
      return ResultGenerator.genResult(RequestSeqEnum.SEQ_012.getCode(), this.fctService.selectMeteoPublicSatisfct());
    } catch (Exception e) {
      log.error("getMeteoPublicSatisfct",e);
      return ResultGenerator.genErrorResult(RequestSeqEnum.SEQ_012.getCode(), RequestStatusEnum.STATUS_503
          .getCode(), "暂无数据");
    } 
  }
}
